/**
 * @description 组件样式
 * @author: 陈陈
 * @date: 2025/05/09
 * @phone: 18560000860
 * @email: 18560000860@qq.com
 * @company: 济南晨霜信息技术有限公司 /
 * @business: 承接前后端项目的开发
 */
.pure-radio {
	position: relative;
	display: var(--pure-radio-display, inline-flex);
	flex-direction: var(--pure-radio-flex-direction, row);
	align-items: var(--pure-radio-align-items, center);
	justify-content: var(--pure-radio-justify-content);
	gap: var(--pure-radio-gap, 5px);
	width: var(--pure-radio-width);

	&__box {
		display: flex;
		flex-direction: row;
		align-items: center;
		justify-content: center;
		flex-shrink: 0;
		width: var(--pure-radio-box-size, 1.2em);
		height: var(--pure-radio-box-size, 1.2em);
		border-radius: var(--pure-radio-box-border-radius, var(--pure-radius-circle));
		position: relative;
		margin: var(--pure-radio-box-margin);
		padding: var(--pure-radio-box-padding);

		&::before {
			content: "";
			position: absolute;
			width: 100%;
			height: 100%;
			background: var(--pure-radio-box-background);
			z-index: 0;
			opacity: var(--pure-radio-box-background-opacity);
			border-radius: inherit;
		}

		&::after {
			content: "";
			position: absolute;
			width: 100%;
			height: 100%;
			background: transparent;
			left: 0;
			top: 0;
			z-index: 0;
			border-radius: inherit;
			border: var(
				--pure-radio-box-border,
				var(--pure-radio-box-border-width, 1px) var(--pure-radio-box-border-style, solid)
					var(--pure-radio-box-border-color, var(--pure-radio-theme, var(--pure-border-color-deep)))
			);
		}
	}

	&__icon {
		font-size: var(--pure-radio-icon-font-size);
		font-weight: var(--pure-radio-icon-font-weight);
		color: var(--pure-radio-icon-color);
		opacity: 0;
		transition: var(--pure-radio-icon-transition, 0.3s);
		position: absolute;
		top: 0;
		left: 0;
		z-index: 2;
		line-height: 1;
		background: transparent;
		border: none;
		width: 100%;
		height: 100%;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}

	&__label {
		flex: 1;
		position: relative;
		z-index: 2;
	}

	&--checked {
		.pure-radio__box {
			&::before {
				background: var(
					--pure-radio-checked-box-background,
					var(--pure-radio-theme, var(--pure-theme-primary))
				);
				opacity: var(--pure-radio-checked-box-background-opacity, 1);
			}

			&::after {
				border-width: var(--pure-radio-checked-box-border-width, var(--pure-radio-box-border-width, 1px));
				border-style: var(--pure-radio-checked-box-border-style, var(--pure-radio-box-border-style, solid));
				border-color: var(
					--pure-radio-checked-box-border-color,
					var(
						--pure-radio-box-border-color,
						var(--pure-radio-checked-box-background, var(--pure-radio-theme, var(--pure-theme-primary)))
					)
				);
			}
		}

		.pure-radio__icon {
			font-size: var(--pure-radio-checked-icon-font-size);
			opacity: 1;
			color: var(--pure-radio-icon-color, var(--pure-text-color-invert));
		}
	}

	&--readonly {
		pointer-events: none;
	}

	&--disabled {
		pointer-events: none;
		opacity: var(--pure-radio-disabled-opacity, var(--pure-opacity-disabled));
	}

	// 幽灵样式
	&--ghost {
		.pure-radio__box {
			border-width: var(--pure-radio-checked-box-border-width, 1px);

			&::before {
				opacity: var(--pure-radio-box-background-opacity, var(--pure-opacity-ghost));
			}
		}

		&.pure-radio--checked {
			.pure-radio__icon {
				color: var(
					--pure-radio-icon-color,
					var(--pure-radio-checked-box-background, var(--pure-radio-theme, var(--pure-text-color-invert)))
				);
			}

			.pure-radio__box::before {
				opacity: var(--pure-radio-checked-box-background-opacity, var(--pure-opacity-ghost));
			}
		}
	}

	// 镂空样式
	&--plain {
		.pure-radio__box {
			border-width: var(--pure-radio-checked-box-border-width, 1px);

			&::before {
				opacity: var(--pure-radio-box-background-opacity, 0);
			}
		}

		&.pure-radio--checked {
			.pure-radio__icon {
				color: var(
					--pure-radio-icon-color,
					var(--pure-radio-checked-box-background, var(--pure-radio-theme, currentColor))
				);
			}

			.pure-radio__box::before {
				opacity: var(--pure-radio-checked-box-background-opacity, 0);
			}
		}
	}

	// 方形
	&--square {
		.pure-radio__box {
			border-radius: var(--pure-radio-box-border-radius, var(--pure-radius-small));
		}
	}

	// 单独占用一行
	&--block {
		display: var(--pure-radio-display, flex);
		width: var(--pure-radio-width, 100%);
	}

	// 标签在前，勾选框在后
	&--reverse {
		flex-direction: var(--pure-radio-flex-direction, row-reverse);
	}

	// 选项卡模式
	&--tab {
		padding: var(--pure-radio-tab-padding, 12px 16px);
		color: var(--pure-radio-tab-color);
		flex: 1;
		text-align: var(--pure-radio-tab-text-align, center);

		&::before {
			content: "";
			position: absolute;
			left: 0;
			top: 0;
			width: 100%;
			height: 100%;
			background: var(--pure-radio-tab-background);
			opacity: var(--pure-radio-tab-background-opacity);
			border-radius: var(--pure-radio-tab-border-radius, var(--pure-radius-none));
			z-index: 0;
		}

		.pure-radio__box {
			display: none;
		}

		&.pure-radio--checked {
			color: var(--pure-radio-tab-checked-color, var(--pure-text-color-invert));

			&::before {
				background: var(
					--pure-radio-tab-checked-background,
					var(--pure-radio-theme, var(--pure-theme-primary))
				);
			}
		}

		&.pure-radio--ghost {
			&.pure-radio--checked {
				color: var(--pure-radio-tab-checked-color, var(--pure-radio-theme));

				&::before {
					opacity: var(--pure-radio-tab-checked-background-opacity, var(--pure-opacity-ghost));
				}
			}
		}

		&.pure-radio--plain {
			&.pure-radio--checked {
				color: var(--pure-radio-tab-checked-color, var(--pure-radio-theme));

				&::before {
					opacity: var(--pure-radio-tab-checked-background-opacity, 0);
				}
			}
		}
	}
}
